from models import DietaryRecord
import dashscope

dashscope.api_key = "sk-f30f096e716f4bf3847df42b880801ed"


def create_dietary_record(user_id, date, meal_type, food_item, quantity, unit, nutrition_info):
    """
    Creates a new dietary record for a given user.

    Args:
        user_id (int): The ID of the user who made the dietary record.
        date (datetime.date): The date of the dietary record.
        meal_type (str): The type of meal (e.g., 'breakfast', 'lunch', 'dinner', 'snack').
        food_item (str): The name of the food item.
    """
    messages = [{
        'role': 'user',
        'content': [
            # {
            #     'image': "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
            # },
            {
                'text': "一道酸辣土豆丝（100克）里的营养成分有什么，按每行“主要营养成分：含量数值55”的键值对格式返回"
            },
        ]
    }]
    # The model name 'qwen-vl-max-0809' is the identity of 'Qwen2-VL-72B'.
    response = dashscope.MultiModalConversation.call(model='qwen-vl-max-0809', messages=messages)
    content = response.output.choices[0].message.content

    print(content)

